/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

Ext.QuickTips.init();
var _pageSize = 20;

var fieldName = ['id', 'name','version', 'buildTime', 'operation'];
var fieldLabel = ['序号','名称', '版本号', '创建时间', '相关操作'];


var saveServlet = '../../servlet/system/ExceptionSave';
var loadServlet = '../../servlet/system/ExceptionLoad';
var deleteServlet = '../../servlet/system/ExceptionDel';
var dbtable = 't_exception';
var theme = '说明书相关';

var checkboxSel = new Ext.grid.CheckboxSelectionModel();
var store;
var data = [
    ['1','系统操作说明书','V1.0','2014-11-10','下载']
];
function buildWindow() {

   // store = new Ext.data.JsonStore({
     //   root: 'data',
     //   proxy : new Ext.data.MemoryProxy(data1),
    //    idProperty: 'id',
   //     totalProperty: 'count',
   //     fields: fieldName,
   //     baseParams: {beginDate: beginDate, endDate: endDate, start: 0, limit: _pageSize}
   //     , autoLoad: true
  //  });
   store = new Ext.data.SimpleStore({data:data,fields:['id', 'name','version', 'buildTime', 'operation']}); 

    var grid = new Ext.grid.GridPanel({
        title: '操作说明书',
        store: store,
        sm: checkboxSel,
        
        columns: [
            checkboxSel,
            {header: fieldLabel[0], width: 180, sortable: true, dataIndex: fieldName[0]},//{header: fieldLabel[0], sortable: true, dataIndex: fieldName[0], hidden: true},
            {header: fieldLabel[1], width: 180, sortable: true, dataIndex: fieldName[1]},
            {header: fieldLabel[2], width: 180, sortable: true, dataIndex: fieldName[2]},
            {header: fieldLabel[3], width: 180, sortable: true, dataIndex: fieldName[3] ,xtype: 'datecolumn', format: 'Y-m-d'},
            {header: fieldLabel[4], width: 180, sortable: true, dataIndex: fieldName[4],renderer:DomUrl},
        ],
        //autoExpandColumn: fieldName[2],
        //renderTo: Ext.getBody(),
        //width: 780,
        //height: 590,
        loadMask: true,
        bbar: new Ext.PagingToolbar({
            pageSize: _pageSize,
            store: store,
            displayInfo: true,
            displayMsg: '显示记录：{0} - {1}   总记录：{2}',
            emptyMsg: "目前没有" + theme + '信息'
        })
    });
    //grid.el.center();
    //store.load({params: {start: 0, limit: _pageSize}});

    var applicationUI = new Ext.Viewport({
        layout: "fit",  
        items: [
            grid
        ]
    });
}
function DomUrl(){ 
   return "<a href=http://localhost:8080/DYJC5Web/fileDOC/OperatingInstructions.doc>下载</a>";
} 

Ext.onReady(buildWindow);  